#运算符

# 数学运算符: +, -, *, /, //, %, **

# 整除 (去掉小数点后面的数)
a = 5;
b = 3;
c = a // b;
print(c);

# 次幂
a = 4;
b = 3;
c = a ** b;
print(c);

# 比较运算符: ==, !=, >, <, >=, <=

# 逻辑运算符: and, or, not
# x and y ---> x为假,返回x,否在返回y
# x and y ---> x为真,返回x,否在返回y
# not 返回真假

# 赋值运算符
# += (数字和字符串)
# -+
# *=
# /=
# //=
# **=

# 位运算符
# &(位与) (二进制中)1,1得1,其余为0
# |(位或) (二进制中)只要有一个为1,则为1; 0, 0得0
a = 3;
b = 2;
# 位运算
# 011
# 010
# --------
# 010

# 位或算
# 011
# 010
# --------
# 011

# 成员运算符 (列表, 元组, 集合, 字典)
# in, not in
arr = [1, 2, 3];
print(1 in arr);
arr = (1, 2, 3);
print(1 in arr);
arr = {1, 2, 3};
print(1 in arr);

# is 引用比较
a = 20;
b = a;
b = 10;
print(id(a) == id(b));
print(a is b);

# 运算符优先级 (从高到底)
# 1. 次幂 **
# 2. 数学 *, /, %, //, +, -
# 3. 位   &, ^, |
# 4. 比较 <=, <, >, >=, <>, ==, !=
# 5. 赋值 =, %=, /=, //=, .=, +=, *=, **=
# 6. 引用 is, is not
# 7. 成员 in, not in
# 8. 逻辑 not, or, and
#
